package com.baozun.houji.goods.widget

import android.content.Context
import android.view.View
import android.view.View.OnClickListener
import com.baozhun.mall.common.model.bean.GoodsInfoBean
import com.baozhun.mall.common.widget.dialog.BaseBottomPopupView
import com.baozun.houji.goods.R
import com.baozun.houji.goods.adapter.GoodsInfoAdapter
import com.baozun.houji.goods.databinding.DialogGoodsInfoBinding
import com.blankj.utilcode.util.SizeUtils

/**
 * @Title：商品信息dialog
 * @Description：
 * @Author：xing.luo
 * @Since：2023/6/16
 * @Version：1.0.0
 */
class GoodsInfoDialog(context: Context, val model: GoodsInfoBean?) : BaseBottomPopupView<DialogGoodsInfoBinding>(context),
    OnClickListener {

    private val mGoodsInfoAdapter by lazy { GoodsInfoAdapter(model?.props_list) }

    override fun getImplLayoutId(): Int {
        return R.layout.dialog_goods_info
    }

    override fun getPopupHeight(): Int {
        return SizeUtils.dp2px(375F)
    }

    override fun onCreate() {
        super.onCreate()
        mBinding.rvGoodsInfo.adapter = mGoodsInfoAdapter
    }

    override fun onClick(v: View?) {
        super.onClick(v)
        when (v?.id) {
            R.id.iv_close, com.baozhun.mall.common.R.id.tv_confirm -> {
                dismiss()
            }
        }
    }

}